package com.laich.springcloud;

import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.oauth2.client.OAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails;

//@EnableFeignClients
@EnableGlobalMethodSecurity(prePostEnabled = true)
@SpringCloudApplication
public class StartUserServiceApplication {
	public static void main(String[] args) {
		SpringApplication.run(StartUserServiceApplication.class, args);
	}
	
	  @Bean
	    public OAuth2RestTemplate oauth2RestTemplate(OAuth2ClientContext oauth2ClientContext,
	                                                 OAuth2ProtectedResourceDetails details) {
	        return new OAuth2RestTemplate(details, oauth2ClientContext);
	    }

}
